package com.spzx.channel.controller;

import com.spzx.channel.service.CategoryService;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.Category;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Tag(name = "分类模块")
@RequestMapping("/category")
public class CategoryController {
    @Resource
    CategoryService categoryService;


    @Operation(summary = "分类页查询分类")
    @GetMapping("/tree")
    public R<List<Category>> categoryTree(){
        List<Category> categories = categoryService.selectCategoryTree();
        return R.ok(categories);
    }

}
